package Day013_线程安全.ZuoYe.Test1;

import java.util.Random;
import java.util.concurrent.Callable;

/**
 * @author zhangyan
 * @date 2020/5/4 18:10
 */
class MyCallable implements Callable<Double> {
    @Override
    public Double call() {
        //线程任务
        Random ran = new Random();
        //循环创建随机数
        double sum = 0;
        double age = 0;
        for (int i = 0; i < 10; i++) {
            int a = ran.nextInt(100) + 1;
            sum += a;
        }
        age = sum / 10;
        return age;
    }
}

